Software-Defined Network ((SDN)) introduces centralized network control via the OpenFlow protocol, enhancing network management, traffic routing, and security policy enforcement. However, (SDN)'s centralized nature also introduces vulnerabilities, particularly to cyberattacks targeting the controller and communication channels. This study presents a resilience assessment methodology for (SDN) under cyberattack conditions, leveraging Markov process theory to model system states and transitions. Three (SDN) architectures were evaluated under various attack scenarios, revealing that traditional configurations lack sufficient resilience against synchronous attacks and controller breaches. To address these vulnerabilities, we propose an enhanced (SDN) protection framework integrating controller redundancy, automatic reconfiguration mechanisms, and anomaly detection using Long Short-Term Memory (LSTM) networks. The methodology was validated through simulations in the EVE-NG environment, demonstrating improved (SDN) stability under cyber threats. These findings provide a foundation for designing more resilient (SDN) infrastructures, ensuring network continuity and security against evolving cyber threats.